package StructureBL;

import java.io.Serializable;
import java.rmi.RemoteException;

import po.StructurePO;
import StructureData.StructureDataController;
import vo.StructureVO;

public class Structure implements Serializable
{
	private StructureDataController data;
	private int commmon;
	private int profession;
	private int require;
	private int total;

	private String semesterBegin;
	private String semesterEnd;
	private String selectLessonBegin;
	private String selectLessonEnd;
	private String reSelectLessonBegin;
	private String reSelectLessonEnd;

	public Structure()
	{
		try
		{
			data = new StructureDataController();
		} catch (RemoteException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public StructureVO getStructure() throws RemoteException
	{
		StructurePO sp = data.Get();
		StructureVO sv = new StructureVO();
		sv.Commmon = sp.Commmon;
		sv.Profession = sp.Profession;
		sv.require = sp.require;
		sv.total = sp.total;
		sv.reSelectLessonBegin=sp.reSelectLessonBegin;
		sv.reSelectLessonEnd=sp.reSelectLessonEnd;
		sv.selectLessonBegin=sp.selectLessonBegin;
		sv.selectLessonEnd=sp.selectLessonEnd;
		sv.semesterBegin=sp.semesterBegin;
		sv.semesterEnd=sp.semesterEnd;
		return sv;
	}

	public boolean setStructure(StructureVO aim) throws RemoteException
	{
		StructurePO sp = data.Get();
		sp.Commmon = aim.Commmon;
		sp.Profession = aim.Profession;
		sp.require = aim.require;
		sp.total = aim.total;
		sp.reSelectLessonBegin=aim.reSelectLessonBegin;
		sp.reSelectLessonEnd=aim.reSelectLessonEnd;
		sp.selectLessonBegin=aim.selectLessonBegin;
		sp.selectLessonEnd=aim.selectLessonEnd;
		sp.semesterBegin=aim.semesterBegin;
		sp.semesterEnd=aim.semesterEnd;
		return data.Update(sp);
	}

}
